package com.kolon.business.mngr.client.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kolon.business.mngr.client.dao.ClientDao;
import com.kolon.framework.interfaces.SimpleController;

@Controller("com.kolon.business.mngr.client.controller.ClientModifyFormController")
public class ClientModifyFormController implements SimpleController {

	@Resource(name="com.kolon.business.mngr.client.dao.ClientDaoImpl")
	private ClientDao clientDao;
	
	@SuppressWarnings("rawtypes")
	@RequestMapping(value="/business/mngr/client/clientModifyForm.do")
	public ModelAndView controller(HttpServletRequest request,
		HttpServletResponse response) throws Exception {
		
		Map<String, String> map = new HashMap<String, String>();
		// 파라미터
		String frfTp = request.getParameter("frfTp");
		// 값 체크
		if ("iPhone".equals(frfTp) || "Android".equals(frfTp)) {
			map.put("frfTp", frfTp);
			// 조회
			Map cntMap = clientDao.getMap(map);
			// 리턴
			ModelAndView modelAndView = new ModelAndView();
			modelAndView.addObject("cntMap", cntMap);
			modelAndView.addObject("frfTp", frfTp);
			return modelAndView;
		} else {
			throw new Exception();
		}
	}
}

